(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/LoadRes.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '62097b6CDtFsIe+ylJ2C4g9', 'LoadRes', __filename);
// Script/LoadRes.js

"use strict";

var self = void 0;
var AU = require("AudioUtils");
cc.Class({
	extends: cc.Component,

	properties: {
		loadbar: { //加载进度
			default: null,
			type: cc.ProgressBar
		}
		/*loadtext: {//进度显示
      default: null,
      type: cc.Label
  },*/
	},

	init: function init() {
		self.loadbar.progress = 0;
		var jiduNode = cc.find("Canvas/zhezhao/jindu_lab");
		self.jn = jiduNode.getComponent(cc.Label);
	},

	onLoad: function onLoad() {
		self = this;
		self.init();

		self._loadRes();
	},

	/**
  * 初始音频资源加载
  */
	_loadRes: function _loadRes() {
		var loadbar = self.loadbar;
		var jindu = 0;
		self.is_loading = true;
		cc.loader.loadResDir("audio", self._progressCallback.bind(self), self._completeCallback.bind(self));
	},

	_progressCallback: function _progressCallback(completedCount, totalCount, res) {
		var loadbar = self.loadbar;
		var jindu = 0;
		if (totalCount !== 0 && self.is_loading === true) {
			jindu = completedCount / totalCount;
		}
		loadbar.progress = jindu;
		var number_jindu = parseInt(jindu * 100);

		self.jn.string = number_jindu + "%";
	},

	_completeCallback: function _completeCallback(error, res) {
		var blockInputs = cc.find('Canvas/zhezhao');
		blockInputs.active = false;

		AU.inst.init(); //音效组件初始化
		AU.inst.playMusic(MUSIC_SPACE_TRIP, true);
	}

});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=LoadRes.js.map
        